<?php
	if($_SERVER["REQUEST_METHOD"]=='POST') {
		$title			= strip_tags($_POST['title']);
		$detail			= $_POST['detail'];
		$status			= $_POST['status']=='publish' ? '1': '0';
		$ip				= getUserIP();

		$sql = "INSERT INTO `tbl_enews` (`content_id`, `title`, `detail`, `ip`, `status`, `date`) VALUES (NULL, '$title', '$detail', '$ip', '$status', NOW());";
		mysql_query($sql);
		redirect('../');
		exit;
	}
 
	include 'ckeditor/ckeditor.php';
	include 'ckeditor/ckfinder/ckfinder.php';
	
	$ckeditor = new CKEditor();
	$ckeditor->returnOutput			= true;
	$ckeditor->basePath				= '/backend/ckeditor/';
	$ckeditor->config['height']		= '500';

	CKFinder::SetupCKEditor($ckeditor, '/backend/ckeditor/ckfinder/');
	$detailHTML = $ckeditor->editor('detail');
?>